﻿USE [QLRAPPHIM]
GO
/****** Object:  StoredProcedure [dbo].[spDonnerLaListDuTemps_DeIDFilm]    Script Date: 06/27/2012 10:01:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spDonnerLaListDuTemps_DeIDFilm]
@idFilm char(5)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT c.IDCalendrier, c.IDFilm, c.Temps
	from Calendrier c join Films f on c.IDFilm=f.IDFilm
	where f.IDFilm = @idFilm
END
GO
/****** Object:  StoredProcedure [dbo].[spDonnerLaListeDuSalle]    Script Date: 06/27/2012 10:02:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spDonnerLaListeDuSalle]
as
begin
	select *
	from Salle
end
GO
/****** Object:  StoredProcedure [dbo].[spDonnerLaListeDuTemps]    Script Date: 06/27/2012 10:03:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spDonnerLaListeDuTemps]
as
begin
	select distinct Temps
	from Calendrier c
end
GO
/****** Object:  StoredProcedure [dbo].[spDonnerLaListeDuTempsDeNomFilm]    Script Date: 06/27/2012 10:04:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spDonnerLaListeDuTempsDeNomFilm](@nomF nvarchar(50))
as
begin
	select distinct Temps
	from Calendrier c join Films f on c.IDFilm = f.IDFilm
	where f.NomF = @nomF
end
GO
/****** Object:  StoredProcedure [dbo].[spGetInfoPerson]    Script Date: 06/27/2012 10:04:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

create proc [dbo].[spGetInfoPerson](@username varchar(20))
as
begin
	select * from Personne p
	where p.Username = @username
end
GO
/****** Object:  StoredProcedure [dbo].[spDonnerTousTypesDuMembre]    Script Date: 06/27/2012 10:04:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spDonnerTousTypesDuMembre]
as
begin
	select distinct TypeM from Membre
end
GO
/****** Object:  StoredProcedure [dbo].[spDonnerTousPositionsDEployee]    Script Date: 06/27/2012 10:04:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spDonnerTousPositionsDEployee]
as 
begin 
	select distinct Position
	from Employee
end
GO
/****** Object:  StoredProcedure [dbo].[spDonnerLaListeDuTypeBillet]    Script Date: 06/27/2012 10:04:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spDonnerLaListeDuTypeBillet]
as
begin
	select *
	from TypeDeBillet t
end
go
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE spMisAJourPersonne
	@IDPerson char(5),
	@password varchar(35),
	@nom nvarchar(30),
	@naissance datetime,
	@telephone varchar(13),
	@email varchar(30)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	BEGIN TRY
		Update Personne
		set Password = @password, Nom = @nom,
			Naissance = @naissance, Telephone = @telephone,
			Email = @email
		where IDPerson = @IDPerson
	END TRY
	BEGIN CATCH
	END CATCH
END
GO

create proc spDonnerListeDuTypeBillet
as 
begin
	BEGIN TRY
		select * from TypeDeBillet
	END TRY
	BEGIN CATCH
	END CATCH
end
go
create proc spDonnerNombreDeBilleDansSalle
@nomdesalle varchar(10)
as
begin
	BEGIN TRY
		select NombreBillet from Salle
		where NomdeSalle = @nomdesalle
	END TRY
	BEGIN CATCH
	END CATCH
end

go
create proc spDonnerLaListeCalenDeIDFilm
@idfilm char(5)
as
begin
	BEGIN TRY
		select *
		from Calendrier
		where IDFilm = @idfilm
	END TRY
	BEGIN CATCH
	END CATCH
end